package com.kwedding.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kwedding.dto.app.RequestLogin;
import com.kwedding.dto.app.ResponseAccountInfo;
import com.kwedding.dto.web.RequestAccountStatistics;
import com.kwedding.dto.web.RequestWebCustomerList;
import com.kwedding.dto.web.RequestWebStatistics;
import com.kwedding.dto.web.ResponseStatistics;
import com.kwedding.dto.web.ResponseWebCustomerList;
import com.kwedding.service.web.WebCustomerService;
import com.kwedding.util.BackJson;
import com.kwedding.util.JsonBackBase;
import com.kwedding.util.LoggerParent;
import com.kwedding.util.Resp_PageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Controller
@RequestMapping("/rest/web/customer")
@Api(tags = "客户")
public class WebCustomerController extends LoggerParent {

	@Autowired
	private WebCustomerService webCustomerService;

	@ApiOperation("获取顾客列表")
	@ResponseBody
	@RequestMapping(value = "getCustomerList", method = { RequestMethod.POST })
	private JsonBackBase<Resp_PageInfo<ResponseWebCustomerList>> getCustomerList(
			@RequestBody RequestWebCustomerList webCustomerList) {
		return BackJson.successObj(webCustomerService.getCustomerList(webCustomerList));
	}

	@ApiOperation("获取订单统计图")
	@ResponseBody
	@RequestMapping(value = "getStatistics", method = { RequestMethod.POST })
	private JsonBackBase<List<ResponseStatistics>> getStatistics(@RequestBody RequestWebStatistics webStatistics) {
		return BackJson.successObj(webCustomerService.getStatistics(webStatistics));
	}

	@ApiOperation("获取接单统计")
	@ResponseBody
	@RequestMapping(value = "getStatisticsByStorePerson", method = { RequestMethod.POST })
	private JsonBackBase<List<ResponseStatistics>> getStatisticsByStorePerson(
			@RequestBody RequestAccountStatistics accountStatistics) {
		return BackJson.successObj(webCustomerService.getStatisticsByStorePerson(accountStatistics));
	}
}
